<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<!--#include file="DataLoad.asp"-->
<html>
<head>
<title><%=GuildName%> - DKP系统</title>
<script language="JavaScript" src="inc/jquery.js"></script>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<meta name="Generator" content="EditPlus">
<meta name="Author" content="SULei">
<meta name="Keywords" content="DKP WOW GUILD">
<meta name="Description" content="">
<link href="<%=StylePath%>/main.css" rel="stylesheet" type="text/css" />
<script language="JavaScript" src="<%=StylePath%>/styleplus.js"></script>
<style type="text/css" media="all">

</style>
</head>

<body>
<%
if request("action")="add" then
call ruleadd()
elseif request("action")="edit" then
call ruleedit()
elseif request("action")="del" then
call ruledel(request("id"))
end if
Sub ruleadd()
	'验证提交数据有效性
	Dim errorinfo
	if not IsNumeric(request("postid")) then errorinfo=errorinfo & "<li>内部参数错误</li>"
	if request("ruler_name")="" then errorinfo=errorinfo & "<li>请填写规则描述</li>"
	if not (IsNumeric(request("ruler_attendee")) and IsNumeric(request("ruler_farmdown")) and IsNumeric(request("ruler_firstdown")) and IsNumeric(request("ruler_findboss")) and IsNumeric(request("ruler_drop"))) then errorinfo=errorinfo & "<li>项目必须为数字</li>"
	'验证///

	if errorinfo<>"" then
		'抛出错误提示
		Response.write "<p>表单信息有误,提示如下:</p><ul>"&errorinfo&"</ul>"
		Response.write "请<a href='"&Url&"'>返回</a>重新修改."
	else
		'写入数据库
		Sql="Select * from ruler where (id is null)"
		rs.open sql,conn,1,3
		rs.addnew
		rs("ruler_name")=request("ruler_name")
		rs("ruler_attendee")=request("ruler_attendee")
		rs("ruler_farmdown")=request("ruler_farmdown")
		rs("ruler_firstdown")=trim(request("ruler_firstdown"))
		rs("ruler_findboss")="0"
		'rs("ruler_drop")=trim(request("ruler_drop"))
		rs("ruler_BOE")=trim(request("ruler_BOE"))
		rs("ruler_ENC")=trim(request("ruler_ENC"))
		rs.update
		rs.close
		Response.redirect Url
	end if
end sub





Sub ruleedit()
	'验证提交数据有效性
	Dim errorinfo
	if not IsNumeric(request("postid")) then errorinfo=errorinfo & "<li>内部参数错误</li>"
	if request("ruler_name")="" then errorinfo=errorinfo & "<li>请填写规则描述</li>"
	if not (IsNumeric(request("ruler_attendee")) and IsNumeric(request("ruler_farmdown")) and IsNumeric(request("ruler_firstdown")) and IsNumeric(request("ruler_findboss")) and IsNumeric(request("ruler_drop"))) then errorinfo=errorinfo & "<li>项目必须为数字</li>"
	'验证///

	if errorinfo<>"" then
		'抛出错误提示
		Response.write "<p>表单信息有误,提示如下:</p><ul>"&errorinfo&"</ul>"
		Response.write "请<a href='"&Url&"'>返回</a>重新修改."
	else
		'写入数据库
		Sql="Select * from ruler where id="&request("postid")
		rs.open sql,conn,1,3
		rs("ruler_name")=request("ruler_name")
		rs("ruler_attendee")=request("ruler_attendee")
		rs("ruler_farmdown")=request("ruler_farmdown")
		rs("ruler_firstdown")=trim(request("ruler_firstdown"))
		rs("ruler_findboss")="0"
		'rs("ruler_drop")=trim(request("ruler_drop"))
		rs("ruler_BOE")=trim(request("ruler_BOE"))
		rs("ruler_ENC")=trim(request("ruler_ENC"))
		rs.update
		rs.close
		Response.redirect "admin_rule.asp"
	end if
end sub
%>
</body>
</html>